home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1996 November
/
CHIP Kasım 1996.iso
/
prog
/
callaudt
/
disk1
/
disk1.exe
/
CA30.MS_
/
CA30.MS
Wrap
Text File
|
1996-02-17
|
18KB
|
625 lines
'**************************************************************************
'* MSSetup Toolkit Setup for CallAudit
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST OPTIONS = 800
CONST APPHELP = 900
CONST BADPATH = 6400
CONST GETNAME = 7500
CONST CONFIRMNAME = 7300
CONST REGCARD = 7801
CONST CONFIRMPREV = 7802
CONST AREACODEDLG = 1000
CONST CIDOPTIONSDLG = 1100
CONST ASKUNINSTALL = 2000
CONST EXITUNINSTALL = 2100
CONST CLOSECOMMSW = 2200
CONST SOUND_OPTIONS = 2300
''Parameters to maximize setup window area
CONST WS_VISIBLE=&H10000000
CONST WS_BORDER =&H00800000
CONST WS_CLIPCHILDREN =&H02000000
CONST GWL_STYLE =-16
CONST SW_SHOWMAXIMIZED=3
DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%,iShow%) AS INTEGER
DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG ''this declaration must all be on one line
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ ''Default destination directory.
GLOBAL DestDrive$ ''Default destination drive
GLOBAL OPTCUR$ ''Option selection from option dialog.
GLOBAL UserName$ ''User name for registration.
GLOBAL UserOrg$ ''User company for registration.
GLOBAL CALAUDITINI$ ''CallAudit INI file name
GLOBAL CALAUDITOLDINI$ ''Old CallAudit INI file name
DECLARE SUB Install
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
INIT:
'
' Make setup window maximized
'
hWnd%=HwndFrame()
i1&=SetWindowLong(hWnd%,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
j1%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle "CallAudit Installation and Setup"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "CA30.INF"
END IF
ReadInfFile szInf$
OPTCUR$ = "1"
DEST$ = "C:\CalAudit"
CALAUDITINI$ = GetWindowsDir+"CalAud32.ini"
CALAUDITOLDINI$ = GetWindowsDir+"CalAudit.ini"
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
'$ENDIF ''DEBUG
'
' Put up welcome dialog
'
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
'
' Put up comm software alert dialog
'
CHECKCOMM:
sz$ = UIStartDlg(CUIDLL$, CLOSECOMMSW, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
UIPopAll
ERROR STFQUIT
END IF
'
' Check if name and company exists from previous installation
'
CHECKNAMEORG:
'First check if new CallAudit ini file exists
IF DoesFileExist(CALAUDITINI$, femExists) = 1 THEN
' Get the current values from the ini file
UserName$ = GetIniKeyString(CALAUDITINI$, "OwnerShip", "registeredOwner")
UserOrg$ = GetIniKeyString(CALAUDITINI$, "OwnerShip", "registeredOwnerCompany")
GOTO CONFIRMOLD
ELSE
'Check if old file exists
IF DoesFileExist(CALAUDITOLDINI$, femExists) = 1 THEN
' Get the current values from the ini file
UserName$ = GetIniKeyString(CALAUDITOLDINI$, "OwnerShip", "registeredOwner")
UserOrg$ = GetIniKeyString(CALAUDITOLDINI$, "OwnerShip", "registeredOwnerCompany")
GOTO CONFIRMOLD
ELSE
GOTO GETNAME
END IF
END IF
'
' Confirm name and company just entered
'
CONFIRMOLD:
SetSymbolValue "ConfirmTextIn", ""
AddListItem "ConfirmTextIn", "Name: " + UserName$
AddListItem "ConfirmTextIn", "Company: " + UserOrg$
CONFIRMOLD1:
sz$ = UIStartDlg(CUIDLL$, CONFIRMPREV, "FConfirmDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
GOTO GETPATH
ELSE
UIPop 1
GOTO GETNAME
END IF
'
' Get name and company for registration
'
GETNAME:
sz$ = UIStartDlg(CUIDLL$, GETNAME, "FNameOrgDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UserName$ = GetSymbolValue("NameOut")
UserOrg$ = GetSymbolValue("OrgOut")
UIPop 1
ELSE
GOSUB ASKQUIT
END IF
'
' Confirm name and company just entered
'
CONFIRM:
SetSymbolValue "ConfirmTextIn", ""
AddListItem "ConfirmTextIn", "Name: " + UserName$
AddListItem "ConfirmTextIn", "Company: " + UserOrg$
CONFIRM1:
sz$ = UIStartDlg(CUIDLL$, CONFIRMNAME, "FConfirmDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
UIPop 1
GOTO GETNAME
END IF
'
' Get drive and path for software destination
'
GETPATH:
' First check if CALL AUDIT ini file and destination path exists
IF DoesFileExist(CALAUDITINI$, femExists) = 1 THEN
IF ( DoesIniSectionExist(CALAUDITINI$, "Location") = 1 ) THEN
IF ( DoesIniKeyExist(CALAUDITINI$, "Location", "ProgramLocation") = 1 ) THEN
' Get the current values from the ini file
DEST$ = GetIniKeyString(CALAUDITINI$, "Location", "ProgramLocation")
ENDIF
END IF
ELSE
' Check for old file
IF DoesFileExist(CALAUDITOLDINI$, femExists) = 1 THEN
IF ( DoesIniSectionExist(CALAUDITOLDINI$, "Location") = 1 ) THEN
IF ( DoesIniKeyExist(CALAUDITOLDINI$, "Location", "ProgramLocation") = 1 ) THEN
' Get the current values from the ini file
DEST$ = GetIniKeyString(CALAUDITOLDINI$, "Location", "ProgramLocation")
ENDIF
END IF
END IF
END IF
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
'
' Get destination drive for later use in copying files
'
DestDrive$ = MID$(DEST$,1,1)
IF IsDriveValid(DestDrive$) = 0 THEN
i% = DoMsgBox("Destination drive ('"+DestDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO GETPATH
END IF
'
' Add : character to make it a full path
'
DestDrive$ = DestDrive$ + ":"
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO CONFIRM
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
Install
'
' Get local area code
'
GETAREACODE:
LOCALAREACODE$ = "540"
' First check if CALL AUDIT ini file and destination path exists
IF DoesFileExist(CALAUDITINI$, femExists) = 1 THEN
IF (DoesIniSectionExist(CALAUDITINI$, "Defaults") = 1) THEN
IF (DoesIniKeyExist(CALAUDITINI$, "Defaults", "localAreaCode") = 1) THEN
' Get the current value from the ini file
LOCALAREACODE$ = GetIniKeyString(CALAUDITINI$, "Defaults", "localAreaCode")
ENDIF
END IF
END IF
SetSymbolValue "EditTextIn", LOCALAREACODE$
sz$ = UIStartDlg(CUIDLL$, AREACODEDLG, "FEditDlgProc", 0, "")
LOCALAREACODE$ = GetSymbolValue("EditTextOut")
CreateIniKeyValue CALAUDITINI$, "Defaults", "localAreaCode", LOCALAREACODE$, cmoOverwrite
UIPop 1
'
' Get Caller ID option
'
GETCIDOPTION:
CIDOPTION$ = "1"
' First check if CALL AUDIT ini file and destination path exists
IF DoesFileExist(CALAUDITINI$, femExists) = 1 THEN
IF (DoesIniSectionExist(CALAUDITINI$, "ModemParms") = 1) THEN
IF (DoesIniKeyExist(CALAUDITINI$, "ModemParms", "CallerIdOption") = 1) THEN
' Get the current value from the ini file
TEMPOPTION$ = GetIniKeyString(CALAUDITINI$, "ModemParms", "CallerIdOption")
IF TEMPOPTION$ = "0" THEN
CIDOPTION$ = "1"
END IF
IF TEMPOPTION$ = "1" THEN
CIDOPTION$ = "2"
END IF
END IF
END IF
END IF
SetSymbolValue "RadioDefault", CIDOPTION$
sz$ = UIStartDlg(CUIDLL$, CIDOPTIONSDLG, "FRadioDlgProc", 0, "")
TEMPOPTION$ = GetSymbolValue("ButtonChecked")
IF TEMPOPTION$ = "1" THEN
CIDOPTION$ = "0"
END IF
IF TEMPOPTION$ = "2" THEN
CIDOPTION$ = "1"
END IF
CreateIniKeyValue CALAUDITINI$, "ModemParms", "CallerIdOption", CIDOPTION$, cmoOverwrite
UIPop 1
'
' Get Sound option
'
GETSOUNDOPTION:
SOUNDOPTION$ = "1"
' First check if CALL AUDIT ini file and destination path exists
IF DoesFileExist(CALAUDITINI$, femExists) = 1 THEN
IF (DoesIniSectionExist(CALAUDITINI$, "Defaults") = 1) THEN
IF (DoesIniKeyExist(CALAUDITINI$, "Defaults", "PlaySystemSounds") = 1) THEN
' Get the current value from the ini file
TEMPOPTION$ = GetIniKeyString(CALAUDITINI$, "Defaults", "PlaySystemSounds")
IF TEMPOPTION$ = "1" THEN
SOUNDOPTION$ = "1"
END IF
IF TEMPOPTION$ = "0" THEN
SOUNDOPTION$ = "2"
END IF
END IF
END IF
END IF
SetSymbolValue "RadioDefault", SOUNDOPTION$
sz$ = UIStartDlg(CUIDLL$, SOUND_OPTIONS, "FRadioDlgProc", 0, "")
TEMPOPTION$ = GetSymbolValue("ButtonChecked")
IF TEMPOPTION$ = "1" THEN
SOUNDOPTION$ = "1"
END IF
IF TEMPOPTION$ = "2" THEN
SOUNDOPTION$ = "0"
END IF
CreateIniKeyValue CALAUDITINI$, "Defaults", "PlaySystemSounds", SOUNDOPTION$, cmoOverwrite
UIPop 1
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'*************************************************************************
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
sz$ = UIStartDlg("mscuistf.dll", REGCARD, "FModelessDlgProc", APPHELP, HELPPROC$)
'
' Create program directories
'
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
'
' Create program directories
'
CreateDir DEST$ + "\sounds\audiotag" , cmoNone
CreateDir DEST$ + "\notepad", cmoNone
OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
WriteToLogFile ""
WriteToLogFile " User chose as destination directory: '" + DEST$ + "'"
WriteToLogFile " User chose option: '" + OPTCUR$ + "'"
WriteToLogFile ""
WriteToLogFile "May have had to create the directory: " + DEST$
WriteToLogFile ""
'
' Delete any existing old database file
'
DBOLDFILE$ = DEST$ + "\CALAUD32.OLD"
IF DoesFileExist(DBOLDFILE$, femExists) = 1 THEN
RemoveFile DBOLDFILE$, cmoForce
END IF
' Program files
AddSectionFilesToCopyList "Program", SrcDir$, DEST$
AddSectionFilesToCopyList "Sounds", SrcDir$, MakePath(DEST$,"sounds")
AddSectionFilesToCopyList "Uninstal", SrcDir$, GetWindowsDir()
' AddSectionFilesToCopyList "AudioTag", SrcDir$, MakePath(DEST$,"sounds\audiotag")
' Windows\System files
AddSectionFilesToCopyList "System", SrcDir$, GetWindowsSysDir()
' Windows files
AddSectionFilesToCopyList "Windows", SrcDir$, GetWindowsDir()
CopyFilesInCopyList
' Take down the "Send in the registration card" dialog
UIPop 1
'
' Create a CallAudit INI file if one doesn't already exist
'
IF ( DoesFileExist(CALAUDITINI$, femExists) = 0 ) THEN
CopyFile GetWindowsDir+"CALAUD32.XXX", CALAUDITINI$, cmoNone, 0
END IF
'
' Add user name and org to Call Audit .ini file
'
IF ( DoesIniSectionExist(CALAUDITINI$, "OwnerShip") = 1 ) THEN
CreateIniKeyValue CALAUDITINI$, "OwnerShip", "registeredOwner", UserName$, cmoOverwrite
CreateIniKeyValue CALAUDITINI$, "OwnerShip", "registeredOwnerCompany", UserOrg$, cmoOverwrite
END IF
IF ( DoesIniSectionExist(CALAUDITINI$, "Location") = 1 ) THEN
CreateIniKeyValue CALAUDITINI$, "Location", "ProgramLocation", DEST$, cmoOverwrite
CreateIniKeyValue CALAUDITINI$, "Location", "DatabaseLocation", DEST$, cmoOverwrite
END IF
'
' Update the DbConvrt INI file if one already exists
'
DBCONVRTINI$ = GetWindowsDir + "DBCNVT32.INI"
IF DoesFileExist(DBCONVRTINI$, femExists) = 1 THEN
CreateIniKeyValue DBCONVRTINI$, "Defaults", "RunDatabaseConversion", "1", cmoOverwrite
END IF
'
' Remove work files
'
RemoveFile GetWindowsDir()+"CALAUD32.XXX", cmoForce
' WriteToLogFile ""
' WriteToLogFile ""
' WriteToLogFile "Analyzing AUTOEXEC.BAT & CONFIG.SYS files"
' WriteToLogFile ""
' Get window version information
' winMajor% = GetWindowsMajorVersion()
' winMinor% = GetWindowsMinorVersion()
' WriteToLogFile " winMajor = " + STR$(winMajor%)
' WriteToLogFile " winMinor = " + STR$(winMinor%)
' update% = 0
' IF winMajor% < 4 THEN
' IF winMinor% < 11 THEN
' update% = 1
' END IF
' END IF
' IF update% = 0 THEN
' WriteToLogFile "No Update of AUTOEXEC.BAT or CONFIG.SYS required"
' ELSE
' WriteToLogFile "Possible Update of AUTOEXEC.BAT or CONFIG.SYS required"
' END IF
' Check if Autoexec.bat needs to have share.exe added or updated
' foundShare% = 0
' OPEN "C:\AUTOEXEC.BAT" FOR INPUT AS #1
' WriteToLogFile ""
' WriteToLogFile ""
' WriteToLogFile ""
' WriteToLogFile "Opened AUTOEXEC.BAT"
' WHILE not EOF (1)
' LINE INPUT #1, nextline$
' WriteToLogFile nextline$
' Concert to upper case
' oneline$ = UCASE$(nextline$)
' foundShare% = INSTR(oneline$, "SHARE.EXE")
' IF foundShare% > 0 THEN
' WriteToLogFile " FOUND SHARE.EXE!!!"
' lockStart% = INSTR(oneline$, "/L")
' lockString$ = MID$(oneline$, lockStart%)
' WriteToLogFile " Lock Parameter = " + lockString$
' END IF
' WEND
' CLOSE #1
' WriteToLogFile ""
' WriteToLogFile "Closed AUTOEXEC.BAT"
' WriteToLogFile ""
' WriteToLogFile ""
' WriteToLogFile ""
'
' Create program groups
'
CreateProgmanGroup "CallAudit", "", cmoNone
ShowProgmanGroup "CallAudit", 1, cmoNone
CreateProgmanItem "CallAudit", "CallAudit32", MakePath(DEST$, "calaud32.exe"), "", cmoOverwrite
CreateProgmanItem "CallAudit", "CallAudit32 Help", MakePath(DEST$, "calaud32.hlp"), "", cmoOverwrite
CreateProgmanItem "CallAudit", "Release Notes", MakePath(DEST$, "RelNotes.txt"), "", cmoOverwrite
CreateProgmanItem "CallAudit", "CallAudit32 Uninstall", MakePath(GetWindowsDir, "CalAudUn.exe"), "", cmoOverwrite
CloseLogFile
END SUB
'*************************************************************************
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION